﻿using System.Net.Sockets;

namespace Net.Client
{
    /// <summary>
    /// TCP客户端类型 
    /// 第三版本 2020.9.14
    /// </summary>
    public class TcpClient : ClientBase
    {
        ~TcpClient()
        {
#if !UNITY_EDITOR
            Close();
#endif
        }

        protected override void OnCreateSocket(string ipAddress, int port)
        {
            Client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
            {
                SendBufferSize = Config.SendBufferSize,
                ReceiveBufferSize = Config.ReceiveBufferSize,
                NoDelay = true
            };
        }
    }
}